//
//  OttoMateAction.h
//  Set Form Values of Current Webpage
//
//  Created by itod on 3/30/07.
//  Copyright 2007 Todd Ditchendorf. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <Automator/AMBundleAction.h>

typedef enum {
	TODAssertionTypePageTitleEquals = 0,
	TODAssertionTypePageHasElementWithId,
	TODAssertionTypePageDoesntHaveElementWithId,
	TODAssertionTypePageContainsText,
	TODAssertionTypePageDoesntContainText,
	TODAssertionTypePageContainsHTML,
	TODAssertionTypePageDoesntContainHTML,
	TODAssertionTypeValueForFormElementWithId,
	TODAssertionTypeValueForFormElementWithName
} TODAssertionType;

@interface OttoMateAction : AMBundleAction {
	id _input;
	NSMutableDictionary *_inputParameters;
}
+ (void)setErrorHandlerScriptPath:(NSString *)path;
+ (NSString *)errorHandlerScriptPath;
+ (void)setAssertionFailedScriptPath:(NSString *)path;
+ (NSString *)assertionFailedScriptPath;
+ (void)setDelay:(NSString *)newStr;
+ (NSString *)delay;

// Protected Methods
- (void)checkParametersForInputVariable;
- (NSString *)appleScriptFilePath;
- (NSString *)appleScriptSource;
- (BOOL)isIdSelected;
- (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary **)errorInfo;
- (void)runErrorHandlerScript:(NSDictionary *)errorInfo;
- (void)runAssertionFailedScript:(NSDictionary *)errorInfo;

- (id)objectForParameterKey:(id)key;

- (id)input;
- (void)setInput:(id)newInput;
- (NSMutableDictionary *)inputParameters;
- (void)setInputParameters:(NSMutableDictionary *)newDict;

- (id)atomicInput;

// Abastract Methods - must impl in subclass
- (NSString *)javaScriptSource;
- (NSString *)javaScriptFilePath;
@end
